#pragma once
#include <nlohmann/json.hpp>
#include <spdlog/spdlog.h>
#include <string>

class Event
{
  protected:
    std::string type;
    std::string name;

  public:
    Event(const nlohmann::json &j)
    {
        j.at("type").get_to(type);
        j.at("name").get_to(name);
    }
    std::string Type() const { return type; }
    std::string Name() const { return name; }
    bool IsAct()
    {
        bool act = CheckAct();
        if (act)
            spdlog::info("Detected event act <{}>:{}", type, name);
        return act;
    }

  protected:
    virtual bool CheckAct() = 0;
};